package com.zofer.study.builder;

import lombok.Data;

/**
 * @description 多个参数 使用建造者模式
 * @date: 2020/9/11 17:48
 */
@Data
public class ManBuilder {
    private String name;
    private String age;

    public ManBuilder(Builder builder) {
        this.name = builder.name;
        this.age = builder.age;
    }

    static class Builder{
        private String name;
        private String age;

        public Builder addName(String name) {
            this.name = name;
            return this;
        }

        public Builder addAge(String age) {
            this.age = age;
            return this;
        }

        public ManBuilder build(){
            return new ManBuilder(this);
        }
    }

}
